import { computed } from 'vue'
import { dateEnUS, dateZhCN, dateZhTW, enUS, zhCN, zhTW } from 'naive-ui'
import { useAppStore } from '@/store'
import { Lang } from '@/enums'

const locale = computed(() => {
	const appStore = useAppStore()
	switch (appStore.lang) {
		case Lang.zh:
			return zhCN
		case Lang.zhTW:
			return zhTW
		default:
			return enUS
	}
})

const dateLocale = computed(() => {
	const appStore = useAppStore()
	switch (appStore.lang) {
		case Lang.zh:
			return dateZhCN
		case Lang.zhTW:
			return dateZhTW
		default:
			return dateEnUS
	}
})

export const useNaiveLocale = () => ({ locale, dateLocale })
